IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SaveVFADocumentBlob]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SaveVFADocumentBlob]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
        
CREATE PROCEDURE [dbo].[SaveVFADocumentBlob]    
(    
 @protocolProcessId INT,    
 @blob IMAGE ,
 @protocolId INT,
 @type VARCHAR(50)  
)    
AS    
BEGIN    
 SET NOCOUNT ON    
    
   
 INSERT INTO dbo.VFADocument(protocolProcessId,Blob,ProtocolId,Type)  
 VALUES ( @protocolProcessId,@blob,@protocolId,LTRIM(RTRIM(@type)))  
     
 IF @@ERROR <> 0 BEGIN    
  RAISERROR('Unable to store Document Blob : ', 16, 1)    
  RETURN    
 END    
      
    
 SET NOCOUNT OFF    
END    